//
//  ReportFormViewController.m
//  EPBPro
//
//  Created by wucha on 2018/8/13.
//  Copyright © 2018年 fc. All rights reserved.
//

#import "ReportFormViewController.h"
#import "MachineReportViewController.h"
#import "OrgReportViewController.h"

@interface ReportFormViewController ()
@property (nonatomic,strong) NSArray *listArray;

@end

@implementation ReportFormViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.titleName = @"报表";
    self.listArray = @[@"设备地区报表",@"组织机构收益报表"];
    self.tableView.separatorStyle = 0;
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    // Return the number of sections.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    return self.listArray.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
        
        UIView *lineView = [UIView new];
        lineView.backgroundColor = DefaultCellLineColor;
        [cell.contentView addSubview:lineView];
        lineView.sd_layout.leftSpaceToView(cell.contentView, 15).bottomSpaceToView(cell.contentView, 0).rightSpaceToView(cell.contentView, 0).heightIs(1);
    }
    // Configure the cell...
    cell.textLabel.text = self.listArray[indexPath.row];
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    if (indexPath.row == 0) {
        MachineReportViewController *machineReportViewController = [[MachineReportViewController alloc] init];
        [self.navigationController pushViewController:machineReportViewController animated:YES];
    }else{
        OrgReportViewController *orgReportViewController = [[OrgReportViewController alloc] init];
        [self.navigationController pushViewController:orgReportViewController animated:YES];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
